$("document").ready(function(e){
	//控制只能输入数字
	$('input#Username').keyup(function() {
		var a = $(this);
		if(/[^\d]/.test(a.val())) {
			var temp_amount1 = a.val().replace(/[^\d]/g, '');
			$(this).val(temp_amount1);
		}
	});
    $('#btn').on('click',function(e){
    	window.location.href="shouye.html";
    });
//发送ajax请求
	$.ajax({
		var account=$('#Usrname').val();
		url:"http://ip:8080/second_hand/login",
		type:"post",
		data:{
			account:$('#Username').val(),
			password:$('#password').val(),
			identity:1,
		},
		success:function(data){
			if(data.code === 0){
				localStorage.setItem('account',account);
				window.location.href="shouye.html";
			}
			else{
				alert(data.msg);
			}
		},
		error:function(xhr,type,e){
		    console.log(xhr,type,e);
		}
	});
});